package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.EarlyEndRefundRulesMapper;
import com.ruoyi.system.domain.EarlyEndRefundRules;
import com.ruoyi.system.service.IEarlyEndRefundRulesService;

/**
 * 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-13
 */
@Service
public class EarlyEndRefundRulesServiceImpl implements IEarlyEndRefundRulesService
{
    @Autowired
    private EarlyEndRefundRulesMapper earlyEndRefundRulesMapper;

    /**
     * 通过id查询提前结束消费退款规则
     *
     * @param id 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则主键
     * @return 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则
     */
    @Override
    public EarlyEndRefundRules selectEarlyEndRefundRulesById(Long id)
    {
        return earlyEndRefundRulesMapper.selectEarlyEndRefundRulesById(id);
    }

    /**
     * 查询提前结束消费退款规则列表
     *
     * @param earlyEndRefundRules 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则
     * @return 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则
     */
    @Override
    public List<EarlyEndRefundRules> selectEarlyEndRefundRulesList(EarlyEndRefundRules earlyEndRefundRules)
    {
        return earlyEndRefundRulesMapper.selectEarlyEndRefundRulesList(earlyEndRefundRules);
    }

    /**
     * 新增提前结束消费退款规则
     *
     * @param earlyEndRefundRules 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则
     * @return 结果
     */
    @Override
    public int insertEarlyEndRefundRules(EarlyEndRefundRules earlyEndRefundRules)
    {
        earlyEndRefundRules.setCreateTime(DateUtils.getNowDate());
        return earlyEndRefundRulesMapper.insertEarlyEndRefundRules(earlyEndRefundRules);
    }

    /**
     * 修改提前结束消费退款规则
     *
     * @param earlyEndRefundRules 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则
     * @return 结果
     */
    @Override
    public int updateEarlyEndRefundRules(EarlyEndRefundRules earlyEndRefundRules)
    {
        earlyEndRefundRules.setUpdateTime(DateUtils.getNowDate());
        return earlyEndRefundRulesMapper.updateEarlyEndRefundRules(earlyEndRefundRules);
    }

    /**
     * 批量删除提前结束消费退款规则信息
     *
     * @param ids 需要删除的提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则主键
     * @return 结果
     */
    @Override
    public int deleteEarlyEndRefundRulesByIds(Long[] ids)
    {
        return earlyEndRefundRulesMapper.deleteEarlyEndRefundRulesByIds(ids);
    }

    /**
     * 删除提前结束消费退款规则信息
     *
     * @param id 提前结束消费退款规则，定义用户提前结束消费时的退款逻辑、渠道及计费规则主键
     * @return 结果
     */
    @Override
    public int deleteEarlyEndRefundRulesById(Long id)
    {
        return earlyEndRefundRulesMapper.deleteEarlyEndRefundRulesById(id);
    }
}
